package com.audaque.springboot.foshanupload.web.raspcloud.controller;

import com.audaque.springboot.foshanupload.web.raspcloud.entity.UserGroupBusinessGroupRel;
import com.audaque.springboot.foshanupload.web.raspcloud.req.UserGroupBusinessGroupRelReq;
import com.audaque.springboot.foshanupload.web.raspcloud.service.IUserGroupBusinessGroupRelService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * <p>
 * 后台用户组和业务组关系表 前端控制器
 * </p>
 *
 * @author chinaben
 * @since 2025-07-02
 */
@RestController

@Api(value = "后台用户组和业务组关系表 前端控制器")

@RequestMapping("/userGroupBusinessGroupRel")
public class UserGroupBusinessGroupRelController {


    @Autowired
    private IUserGroupBusinessGroupRelService iUserGroupBusinessGroupRelService;

    @PostMapping(value = "/page")
    @ApiOperation(value = "后台用户组和业务组关系表 分页查询")
    public Page<UserGroupBusinessGroupRel> page(@RequestBody UserGroupBusinessGroupRelReq req) {
        QueryWrapper queryWrapper = new QueryWrapper(req);
        Page<UserGroupBusinessGroupRel> page = iUserGroupBusinessGroupRelService.page(new Page<>(req.getPage(), req.getRows()),queryWrapper);
        return page;
    }




    @PostMapping(value = "/list")
    @ApiOperation(value = "后台用户组和业务组关系表 列表查询")
    public List<UserGroupBusinessGroupRel> list(@RequestBody UserGroupBusinessGroupRelReq req) {
        QueryWrapper queryWrapper = new QueryWrapper(req);
        List<UserGroupBusinessGroupRel> list = iUserGroupBusinessGroupRelService.list(queryWrapper);
        return list;
    }





    @GetMapping(value = "/{id}")
     @ApiOperation(value = "后台用户组和业务组关系表 单体查询")
    public UserGroupBusinessGroupRel getById(@PathVariable("id") String id) {
        UserGroupBusinessGroupRel one=iUserGroupBusinessGroupRelService.getById(id);
        return one;
    }

    @PostMapping(value = "/create")
     @ApiOperation(value = "后台用户组和业务组关系表 创建")
    public void create(@RequestBody UserGroupBusinessGroupRel params) {
        iUserGroupBusinessGroupRelService.save(params);
    }

    @PostMapping(value = "/delete/{id}")
     @ApiOperation(value = "后台用户组和业务组关系表 删除")
    public void delete(@PathVariable("id") String id) {
        iUserGroupBusinessGroupRelService.removeById(id);
    }




    @PostMapping(value = "/update")
     @ApiOperation(value = "后台用户组和业务组关系表 更新")
    public void update(@RequestBody UserGroupBusinessGroupRel params) {
        iUserGroupBusinessGroupRelService.updateById(params);
    }















}
